package com.jlz.actions.console.category;

import org.apache.struts2.convention.annotation.Standard;
import org.springframework.beans.factory.annotation.Autowired;

import com.jlz.beans.core.CategoryBean;
import com.jlz.managers.core.Categories;

@Standard(rest="categoryId")
public class IndexAction {
	private @Autowired Categories categories;
	//由spring保证生成一个新实例!
	private CategoryBean category = null;
	private Long categoryId = null;	
	public String execute(){
		if(categoryId == null)return "list";
		setCategory(categories.get(categoryId));
		return "edit";
	}
	public void setCategory(CategoryBean category) {
		this.category = category;
	}
	public CategoryBean getCategory() {
		return category;
	}
	public Long getCategoryId() {
		return categoryId;
	}
	public void setCategoryId(Long categoryId) {
		this.categoryId = categoryId;
	}
	

	
}
